<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>后台管理</title>
    <link rel="stylesheet" type="text/css" href="/css/nav.css">
    <link rel="stylesheet" type="text/css" href="/font/iconfont.css">
    <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <script src="/layui/layui.js"></script>
    <script type="text/javascript" src="/js/nav.js"></script>
</head>
<body>
<div class="nav" style="float: left;" th:include="/common/nav :: nav"></div>
<div style="float: left;height: 100%;width: 87.5%;background-color: rgb(235, 243, 243);" >
    <div class="content">

        <form class="layui-form" action="">
            <div class="layui-form-item" style="font-size:30px;text-align: center;font-weight: bolder">新增工作区域：</div>



            <div class="layui-form-item">
                <label class="layui-form-label">省市区<span class="red">*</span></label>
                <div class="layui-input-inline">
                    <select name="city" lay-verify="">
                        <option value="">请选择一个省份</option>
                        <option selected value="010" >广东</option>
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="city" lay-verify="">
                        <option value="">请选择一个城市</option>
                        <option selected value="010">广州</option>
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="city" lay-verify="">
                        <option value="">请选择一个区</option>
                        <option selected value="010">从化</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">详细地址<span class="red">*</span></label>
                <div class="layui-input-block">
                    <textarea name="desc" id="address" placeholder="请输入详细地址（如：某镇或某街道）" required lay-verify="required" class="layui-textarea"></textarea>
                </div>
            </div>



            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>

        <script>
            //Demo
            layui.use('form', function(){
                var form = layui.form;

                //监听提交
                form.on('submit(formDemo)', function(data){


                    var $address = $("#address").val();
                    if ($address==""){
                        layer.msg("地址信息不能为空！");
                        return false;
                    }else {

                        $.post("/admin/addWorkingArea",{"address":"广东省广州市从化区"+$address},function (data) {

                            if (data.code==200){
                                layer.alert(data.msg,{icon:6});
                            }else if (data.code==500){
                                layer.alert(data.msg,{icon:5});
                            }
                        });
                    }

                    return false;
                });
            });
        </script>
    </div>
</div>
</body>
</html>